<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	 <xsl:template match="/report">
	 
	 	<html>
	 		<head>
	 			<title>
	 				<xsl:value-of select="@title"/>
	 			</title>
	 		</head>
	 		
	 		<body>
	 		
	 			<h1>
	 				<xsl:value-of select="@title"/>
	 			</h1>
	 		
	 			<table>
	 					 		
	 				<xsl:apply-templates />
	 				
	 			</table>
	 		
	 		</body>	 	
	 	</html>
	 
	 </xsl:template>
	 
	 
	<xsl:template match="query-result">
	
		<tr>
			<td colspan="2">
				<xsl:value-of select="@title"/>
			</td>
		</tr>
	
		<tr>
			<td valign="top"> <!-- Values -->
			
				<table>
					<xsl:for-each select="row">
						<tr>

							<xsl:for-each select="label">
								<td style="font-weight:bold;">
									<xsl:value-of select="."/>
								</td>						
							</xsl:for-each>										

							<xsl:for-each select="p">
								<td>
									<xsl:value-of select="."/>
								</td>						
							</xsl:for-each>	

						</tr>
					</xsl:for-each>	
				</table>
				
			</td>
		
			<td valign="top"> <!-- Graph -->
				<xsl:if test="@graph != ''">
					<img>
						<xsl:attribute name="src">
							<xsl:value-of select="@graph" />
						</xsl:attribute>      					
					</img>
				</xsl:if>
			</td>
		</tr>
			
	</xsl:template>
	

</xsl:stylesheet>
